﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SceneLib
{
    public class Vertex
    {
        public SceneMaterial Material { get; set; }
        public Vector Color { get; set; }
        public float u { get; set; }
        public float v { get; set; }
        public float x { get; set; }
        public float y { get; set; }
        public float z { get; set; }
        public float w { get; set; }        

        public Vertex Copy()
        {
            return new Vertex
            {
                Material = this.Material,
                Color = this.Color.Copy(),
                u = this.u,
                v = this.v,
                x = this.x,
                y = this.y,
                z = this.z,
                w = this.w
            };
        }

        public static Vertex operator -(Vertex v1, Vertex v2)
        {
            return new Vertex
            {
                Material = v1.Material,
                Color = v1.Color - v2.Color,
                u = v1.u - v2.u,
                v = v1.v - v2.v,
                x = v1.x - v2.x,
                y = v1.y - v2.y,
                z = v1.z - v2.z,
                w = v1.w - v2.w
            };
        }

        public static Vertex operator +(Vertex v1, Vertex v2)
        {
            return new Vertex
            {
                Material = v1.Material,
                Color = v1.Color + v2.Color,
                u = v1.u + v2.u,
                v = v1.v + v2.v,
                x = v1.x + v2.x,
                y = v1.y + v2.y,
                z = v1.z + v2.z,
                w = v1.w + v2.w
            };
        }

        public static Vertex operator *(float scalar, Vertex v)
        {
            return new Vertex
            {
                Material = v.Material,
                Color = v.Color * scalar,
                u = v.u * scalar,
                v = v.v * scalar,
                x = v.x * scalar,
                y = v.y * scalar,
                z = v.z * scalar,
                w = v.w * scalar
            };
        }

        public static Vertex operator *(Vertex v, float scalar)
        {
            return new Vertex
            {
                Material = v.Material,
                Color = v.Color * scalar,
                u = v.u * scalar,
                v = v.v * scalar,
                x = v.x * scalar,
                y = v.y * scalar,
                z = v.z * scalar,
                w = v.w * scalar
            };
        }
    }
}
